#include <bits/stdc++.h>
#include <string>
using namespace std;

int res[10000];
int main()
{
	int n, m, k;
	cin >> n >> k;
	m = abs(k);
	int arr[n];
	for (int i = 0; i < n; i++)
		cin >> arr[i];
	if (k != 0)
	{
		for (int i = 0; i < n; i++)
		{
			int t = 0, j = 0;
			j = k > 0 ? (i + 1) % n : (i - 1 < 0 ? n - 1 : i - 1);
			while (t < m)
			{
				res[i] += arr[j];
				j = k > 0 ? (j + 1) % n : (j - 1 < 0 ? n - 1 : j - 1);
				t++;
			}
		}
	}
	for (int i = 0; i < n; i++)
		cout << res[i] << " ";
	return 0;
}
